package com.example.demo.service.impl;

import com.example.demo.common.ResponseBack;
import com.example.demo.dao.UserDao;
import com.example.demo.domain.User;
import com.example.demo.exception.BusinessException;
import com.example.demo.exception.ExceptionCode;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * Created by Administrator on 2017/10/26 0026.
 */
@Service
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {


    @Autowired
    private UserDao userDao;

    public ResponseBack<User> findUserById(Long id) {
        if(id==null){
            throw new BusinessException(ExceptionCode.ID_IS_NULL);
        }
        User user = userDao.findById(id);
        return ResponseBack.success(user);
    }
}
